home *** CD-ROM | disk | FTP | other *** search
/ Die Ultimative Software-P…i Collection 1996 & 1997 / Die Ultimative Software-Pakete CD-ROM fur Atari Collection 1996 & 1997.iso / i / internet / software / tuwtcpsr / arp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-06  |  1.2 KB  |  75 lines

  1. /*
  2.  * ARP definitions
  3.  */
  4.  
  5.  
  6. #ifndef    _INET_ARP
  7. #define _INET_ARP
  8.  
  9.  
  10. #ifndef _INET_PKT
  11. #include "pktdrv.h"
  12. #endif
  13. #ifndef _INET_IP
  14. #include "ip.h"
  15. #endif
  16.  
  17. #define ARP_ET        0x01   /* ARP type of Ethernet address */
  18.  
  19. /* arp op codes */
  20. #define ARP_REQUEST     0x01
  21. #define ARP_REPLY       0x02
  22. #define ARP_RREQUEST    0x03
  23. #define ARP_RREPLY        0x04
  24.  
  25. /* Arp header */
  26. typedef struct
  27. {
  28.   u_short            hw_type;
  29.   u_short            protocol;
  30.   u_char            hw_len;          /* hw and prot addr len */
  31.   u_char            pr_len;
  32.   u_short            opcode;
  33.   HADDR                src_haddr;
  34.   INADDR            src_inaddr;
  35.   HADDR                dst_haddr;
  36.   INADDR            dst_inaddr;
  37. } ARP;
  38.  
  39. typedef struct
  40. {
  41.     ETH        et;
  42.     ARP        arp;
  43.     char    arp_data[40];
  44. } ARP_PACKET;
  45.  
  46. #define arp_head(pkt)    (&(((ARP_PACKET *)pkt)->arp))
  47. #define ARP_PKTSIZE        (int)(sizeof(ETH)+sizeof(ARP))
  48. #define ARP_TIMEOUT        250
  49. #define ARP_RETRIES        8
  50. #define ARPCACHESIZE    15
  51.  
  52. #define ARP_FAIL        0
  53. #define ARP_WAIT        1
  54. #define ARP_OK            2
  55.  
  56.  
  57. typedef struct
  58. {
  59.   INADDR    inaddr;
  60.   HADDR        haddr;
  61.   long        timeout;
  62.   u_short    resend;
  63. } arp_cache;
  64.  
  65.  
  66. int arp_handler(void);
  67. int arp_in2haddr(INADDR, HADDR);
  68. int arp_addgw(INADDR, HADDR);
  69. int    arp_add2tab(INADDR,HADDR);
  70. int arp_init(void);
  71. int arp_exit(void);
  72.  
  73.  
  74. #endif
  75.